/**
 * 
 */
package denaris.core.controller;

import denaris.midlet.GameScreen;

/**
 * This controller class gets a certain direction passed to it in the constuctor
 * and moves its controllable in that direction. The movement is slown down with
 * every update-call.
 * The Scrolling is also accounted for.
 * 
 * @author The Witch-King
 * 
 */
public class DegressiveVectorController extends AbstractController {
	private int deltaX;
	private int deltaY;
	
	public DegressiveVectorController(int dx, int dy) {
		deltaX = dx;
		deltaY = dy;
	}

	public boolean advance() {
		controllable.move(deltaX - GameScreen.SCROLL_SPEED, deltaY);
		// slow movement down
		deltaX >>= 1;
		deltaY >>= 1;
		
		return isInScope(controllable.getX(), controllable.getY());
	}

	public int getDeltaY() {
		return deltaY;
	}

	public void setDeltaY(int deltaY) {
		this.deltaY = deltaY;
	}

	public int getDeltaX() {
		return deltaX;
	}

	public void setDeltaX(int deltaX) {
		this.deltaX = deltaX;
	}
}
